﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System.Reflection;

#endregion

namespace ScrumTable.UI.ViewModel.Dynamic
{
    /// <summary>
    /// 
    /// </summary>
    public static class DynamicValueResolverLoader  
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------
        private static readonly IDynamicValueResolver Resolver;
   
        #endregion

        #region Constructors
        //--------------------------------------------------------------------
        // Constructors
        //--------------------------------------------------------------------

        static DynamicValueResolverLoader()
        {
            object[] attributs = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(DynamicValueResolverAttribute), false);
            if (attributs.Length > 0)
            {
                DynamicValueResolverAttribute attribut = (DynamicValueResolverAttribute)attributs[0];
                Resolver = attribut.TryCreateContext();
            }
        }
     
        #endregion


        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        public static IDynamicValueResolver TryGetDynamicValueResolver()
        {
            return Resolver;
        }
      
        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}